package cn.glc.daily.life.web.convert;

import cn.glc.daily.life.infrastructure.po.DictPo;
import cn.glc.daily.life.model.dto.dict.DictOpenOrCloseDto;
import cn.glc.daily.life.model.dto.dict.DictSaveOrUpdateDto;
import cn.glc.daily.life.model.vo.dict.DictVo;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * 字典类对象转换
 *
 * @author simon
 * @date 2021/4/13 12:00
 * @copyright:
 * @modifier
 * @motto a no talent, people who have to study hard
 */
@Mapper
public interface DictConvert {

    DictConvert INSTANCE = Mappers.getMapper(DictConvert.class);

    /**
     * po 转 vo
     *
     * @param dictPo 数据库层对象
     * @return
     */
    DictVo dictPoToDictVo(DictPo dictPo);

    /**
     * po 转 vo
     *
     * @param dictPo 数据库层对象
     * @return
     */
    List<DictVo> dictPoToDictVo(List<DictPo> dictPo);

    /**
     * 新增或修改 po 转 vo
     *
     * @param dictSaveOrUpdateDto
     * @return
     */
    DictPo normalConvert(DictSaveOrUpdateDto dictSaveOrUpdateDto);

    /**
     * 开启关闭 dto 转 po
     *
     * @param dictOpenOrCloseDto
     * @return
     */
    DictPo normalConvert(DictOpenOrCloseDto dictOpenOrCloseDto);
}
